package cn.edu.cjw.APMFP.ui.component;

import javax.swing.border.Border;
import java.awt.*;

/**
 * @package 圆角边框
 * @className RoundBorder
 * @note TODO
 * @author wind
 * @date 2022/3/11 22:57
 */
public class RoundBorder implements Border {

    private final Color color;

    // 有参数的构造方法
    public RoundBorder(Color color) {
        this.color = color;
    }

    @Override
    public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
        g.setColor(color);
        g.drawRoundRect(0, 0, c.getWidth() - 1, c.getHeight() - 1, 15, 15);
    }

    @Override
    public Insets getBorderInsets(Component c) {
        return new Insets(0, 0, 0, 0);
    }

    @Override
    public boolean isBorderOpaque() {
        return false;
    }
}
